package com.sunlands.zlcx.usercenter.vo.share;

import com.fasterxml.jackson.annotation.JsonFormat;
import com.sunlands.zlcx.usercenter.domain.share.UserShareZanDO;
import io.swagger.annotations.ApiModelProperty;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;

import java.io.Serializable;
import java.util.Date;
import java.util.Objects;

@Data
@Builder
@AllArgsConstructor
@NoArgsConstructor
public class UserShareZanVO implements Serializable {
    private static final long serialVersionUID = 4736724911014301223L;
    private Long id;
    @ApiModelProperty(value = "分享id")
    private Long shareId;
    @ApiModelProperty(value = "学习id")
    private Long learnId;
    @ApiModelProperty(value = "打卡用户id")
    private Long zanUserId;
    @ApiModelProperty(value = "打卡用户名称")
    private String zanUserName;
    @ApiModelProperty(value = "打卡用户头像")
    private String zanUserAvatar;
    @ApiModelProperty(value = "分享用户id")
    private Long shareUserId;
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss",timezone = "GMT+8")
    @ApiModelProperty(value = "创建时间")
    private Date createTime;
    public static UserShareZanVO from(UserShareZanDO userShareZanDO) {
        return Objects.isNull(userShareZanDO) ? null : UserShareZanVO.builder()
                .id(userShareZanDO.getId())
                .zanUserId(userShareZanDO.getZanUserId())
                .createTime(userShareZanDO.getCreateTime())
                .learnId(userShareZanDO.getLearnId())
                .shareId(userShareZanDO.getShareId())
                .shareUserId(userShareZanDO.getShareUserId())
                .build();
    }

}
